import { createRouter, createWebHistory } from "vue-router";

import login from "@/views/Login";
import index from "@/components/Index";
import Member from "@/views/reggie/member/MemberList";
import Home from "@/views/reggie/home/homeList";
import Category from "@/views/reggie/category/CategoryList";
import Dish from "@/views/reggie/dish/DishList";
import Setmeal from "@/views/reggie/setmeal/SetmealList";
import Order from "@/views/reggie/order/OrderList";

const routes = [
  { name: "Login", path: "/login", component: login },
  {
    name: "Index",
    path: "/",
    component: index,
    redirect: "/home",
    children: [
      {
        name: "Home",
        path: "/home",
        component: Home,
        meta: {
          requireAuth: true,
        },
      },
      {
        name: "Member",
        path: "/member",
        component: Member,
        meta: {
          requireAuth: true,
        },
      },

      {
        name: "Category",
        path: "/category",
        component: Category,
        meta: {
          requireAuth: true,
        },
      },
      {
        name: "Dish",
        path: "/dish",
        component: Dish,
        meta: {
          requireAuth: true,
        },
      },
      {
        name: "Setmeal",
        path: "/setmeal",
        component: Setmeal,
        meta: {
          requireAuth: true,
        },
      },
      {
        name: "Order",
        path: "/order",
        component: Order,
        meta: {
          requireAuth: true,
        },
      },
    ],
  },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;
